<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    
    var f = (function(){
        var a = 10;
        return function(){
            a++;
            console.log(a);
        }
    })();

    f();
    f();
    f();
    f();

    var abc = f;
    abc();

    var obj = {}
    obj.qwe = abc;
    obj.qwe();

    function fn(){
        function abc(){
            obj.qwe();
        }
        abc()
    }
    fn()

    document.onclick = obj.qwe;


    console.log(a)

    // 利用作用域的嵌套，将原本的局部变量，进化成私有变量，的环境，叫闭包

    // 实现将原本要删除的数据，又临时保存起来

</script>
</html>